<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>电影评论</title>
    <%- include common %>
</head>

<body>
    <%- include('head',{title:'comment',username}) %>

    <!-- <h2 class="text-danger  text-center">电影信息</h2> -->


    <div class="container container-fluid">
        <div class="row">
            <div class="col-md-6 col-sm-6 col-lg-6">
                <h2 class="text-danger  text-center">电影信息</h2>
                <div class="thumbnail">
                    <img src="<%- result.images.large.replace(/img7/,'img3') %>" alt="" style="height:260px;width:100%">
                    <div>
                        <h4 class="pull-right"> <%- result.year %> </h4>
                        <h4 class="text-danger"> <%- result.title %> </h4>
                        <p class="text-success">评分 : <%- result.rating.average %></p>
                        <p class="text-primary">分类 : <%- result.genres %></p>
                        <p class="text-primary">导演 : <%- result.directors[0].name %></p>
                        <p class="text-danger">主演 :
                            <%    result.casts.forEach(item=>{  %>
                            <span><%- item.name %></span>
                            <%    })  %>
                        </p>
                        <p style="display:flex;">
                            <%    result.casts.forEach(item=>{  %>
                            <img style="flex:1;height:80px;margin:0 10px"
                                src="<%- item.avatars.small.replace(/img7/,'img3') %>" />
                            <%    })  %>
                        </p>
                    </div>
                </div>
            </div>

            <div class="col-md-6 col-sm-6 col-lg-6">
                <h2 class="text-success text-center">电影评论</h2>
                <form action="/comment/submit?mid=<%- result.id %>" method="POST">
                    <div class="form-group">
                        <label for="title">评论标题:</label>
                        <input id="title" name="title" type="text" class="form-control" placeholder="请输入评论标题">
                    </div>
                    <div class="form-group">
                        <label for="content">评论内容:</label>
                        <textarea cols="" rows="16" id="content" name="content" class="form-control"
                            placeholder="请输入评论标题"></textarea>
                    </div>
                    <div class="form-group">
                        <button type="submit" class="btn btn-success">提交评论</button>
                        <button type="reset" class="btn btn-danger">重置</button>
                    </div>
                </form>
            </div>
        </div>

    </div>


    <%- include foot %>

</body>


<script>

    // $('#content').xheditor(); //副文本初始化
    $(pageInit);
        function pageInit(){
            $.extend(XHEDITOR.settings,{shortcuts:{"ctrl+enter":submitForm}});
            // $("#ele").xheditor();
            $("#content").xheditor({   //初始化 富文件编辑框
                html5Upload:false,
                upMultiple:"1",

                upLinkRrl:"upload.html",
                upLinkExt:"zip,rar,txt",

                upImgUrl:"/comment/uploadImg",   // 图片上传的服务器  
                upImgExt:"jpg,jpeg,gif,png",

                upFlashUrl:"upload.php",
                upFlashExt:"swf",

                upMediaUrl:"upload.php",
                upMediaExt:"wmv,avi,wma,mp3,mid"

            });
        };

        function insertUpload(arrMsg){
            console.log(arrMsg);
            var i,msg;
            for(var i=0;i<arrMsg.length;i++){
                msg=arrMsg[i];
                console.log(msg);
                $("#uploadList").append('<option value="'+msg.id+'">'+msg.localname+'</option>')
            }
        };

        function submitForm(){
            $("#frmDemo").submit();
        }



</script>

</html>